﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using SuperSnake.Properties;

namespace SuperSnake
{
    class foodblock:Block
    {
        public Bitmap foodmap =Resources.foodBlock;
        public foodblock(Point locat)
            : base(locat)
        { }
        /*重写draw方法*/
        public override void Draw(IntPtr winHandle)
        {
            Graphics g = Graphics.FromHwnd(winHandle);
            Rectangle r = new Rectangle(new Point(location.X-2,location.Y-3), new Size(24,26));
            g.DrawImage(foodmap, r);
        }
        /*重写erase方法*/
        public override void Erase(IntPtr winHandle)
        {
            Graphics g = Graphics.FromHwnd(winHandle);
            Rectangle r = new Rectangle(new Point(location.X - 2, location.Y - 3), new Size(24, 26));
            g.FillRectangle(new SolidBrush(GameField.backColor), r);
        }
    }
}
